$(function(){
	$('#login').click(function(){
		check_login();
	});
	
    //模态框关闭移除抖动 shake_effect
	   $(".close").click(function(){
		   $("#login_form").removeClass('shake_effect'); 
	   });
})

function check_login()
{

		  var username=$('#username').val();
		  var password=$('#password').val();	  
		  if(username !="" && password !=""){
			  var url="login.do";
			  var args={"username":username,"password":password,"time":new Date()};
			  $.post(url,args,function(data){
                if("error"==data){
	                 doudong();
				  }else if("success"==data){
                     window.location.replace(window.location.href);
				  }
			  });
		  }else{
			  doudong();
		  } 
}

//抖动
function doudong()
{
	   $("#login_form").removeClass('shake_effect');  
	   setTimeout(function(){
	    $("#login_form").addClass('shake_effect')
	   },1); 
}

